package com.dj.dormitory.controller;


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.dj.dormitory.commonutils.Result;
import com.dj.dormitory.entity.Storey;
import com.dj.dormitory.service.StoreyService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author DJ同学
 * @since 2021-01-24
 */
@RestController
@RequestMapping("/storey")
public class StoreyController {

    @Autowired
    private StoreyService storeyService;

    @PostMapping("getList")
    public Result getList(@RequestBody Storey storey){
        QueryWrapper<Storey> wrapper = new QueryWrapper<>();
        wrapper.eq("building_id",storey.getBuildingId());
        List<Storey> list = storeyService.list(wrapper);
        return Result.ok().data("storeys",list);
    }
}

